package com.yld.user.utils;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBUtil {
	
	
	
	
	
	/**
	 * 获取数据库连接
	 * @return
	 * @throws Exception
	 */
	public static Connection getConnection() throws Exception{
		
		String user    = "huanglaoshi";
		
		String password = "123456";
		
		//连接本地的xe数据库
		String url="jdbc:oracle:thin:@localhost:1521:xe";
		
		
		String driver="oracle.jdbc.OracleDriver";
		
		
		//1 加载驱动程序  连接数据库...
		Class.forName(driver);
		
		
		//2 连接数据库
		Connection  connection = DriverManager.getConnection(url, user, password);
		
		return connection;
	}
	

}
